/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package de.jrk_verwaltung.security.login.stats;

import de.jrk_verwaltung.security.login.CLoginController;

import org.apache.commons.lang3.builder.EqualsBuilder;
import org.apache.commons.lang3.builder.HashCodeBuilder;

/**
 * 
 * @author JRK-FO
 */
public class CNotLogOnState implements ILoginState {
    private final int stateIndex = 5;
    private final String stateText = "Waiting for result";

    @Override
    public void executeState(final CLoginController loginController) {
        loginController.cancelLogin();
    }

    @Override
    public int getIndex() {
        return stateIndex;
    }

    @Override
    public String getText() {
        return stateText;
    }

    @Override
    public int hashCode() {
        return new HashCodeBuilder().append(this.stateIndex).append(this.stateText).toHashCode();
    }

    @Override
    public boolean equals(Object obj) {
        ILoginState loginState;
        if (!(obj instanceof ILoginState)) {
            return false;
        }

        loginState = (ILoginState) obj;

        if (this == loginState) {
            return true;
        }

        return new EqualsBuilder().append(this.getIndex(), loginState.getIndex()).append(this.getText(), loginState.getText()).isEquals();
    }
}
